package com.hualan.controller;

import com.hualan.domain.Consultwait;
import com.hualan.service.ConsultwaitService;
import com.hualan.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/Consultwait")
public class ConsultwaitController {
    @Autowired
    private ConsultwaitService consultwaitService;


    @PostMapping("/selectAllConsultWait")
    public R selectAllConsultWait(int userId , int status){
        return consultwaitService.selectAllConsultWait(userId,status);
    }

    @PostMapping("/insertConsultwait")
    public R insertConsultwait(Consultwait consultwait){

        consultwait.setCreatetime(new Date());
        return R.success(consultwaitService.insertSelective(consultwait));
    }

    @DeleteMapping("/deleteConsultwait")
    public R deleteConsultwait(int id){
        return R.success(consultwaitService.deleteByPrimaryKey((long) id));
    }

    @PutMapping("/updateConsultwait")
    public R updateConsultwait(Consultwait consultwait){
        return R.success(consultwaitService.updateByPrimaryKey(consultwait));
    }

    @GetMapping("/selectConsultwait")
    public R selectConsultwait(int id){
        return R.success(consultwaitService.selectByPrimaryKey((long) id));
    }

}
